// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'

// 安装插件
Vue.use(ElementUI)

Vue.prototype.$goRoute = function (index) {
  this.$router.push(index)
}

Vue.config.productionTip = false // 阻止启动生产消息，常用作指令,消息提示的环境配置，设置为开发环境或者生产环境

// 声明全局自定义指令style
// 注册一个全局自定义指令 `v-style`
Vue.directive('style', {
  // 当被绑定的元素插入到 DOM 中时……
  inserted: function (el, binding) {
    console.log(el)
    console.log(binding.value)
    console.log(binding.arg)
    el.style[binding.arg] = binding.value // 设置binding的某个参数为某个值，比如el.style[color]="red"
    // 使用方式：v-style:color="red"
  }
})

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})
